<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="Mark Otto, Jacob Thornton, and Bootstrap contributors">
    <meta name="generator" content="Jekyll v4.0.1">
    <title>Signin Template · Bootstrap</title>

    <!-- Bootstrap core CSS -->
    <link href="./css/bootstrap.css" rel="stylesheet">

    <style>
        .bd-placeholder-img {
            font-size: 1.125rem;
            text-anchor: middle;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
        }

        @media (min-width: 768px) {
            .bd-placeholder-img-lg {
                font-size: 3.5rem;
            }
        }
    </style>
    <!-- Custom styles for this template -->
    <link href="./css/login.css" rel="stylesheet">
</head>
<body class="text-center">
<div class="form-signin">
    <h1 class="h3 mb-3 font-weight-normal">Please sign in</h1>
    <label for="inputEmail" class="sr-only">Email address</label>
    <input type="email" id="inputEmail" name="inputEmail" class="form-control" placeholder="Email address" required
           autofocus>
    <label for="inputPassword" class="sr-only">Password</label>
    <input type="password" id="inputPassword" name="inputPassword" class="form-control" placeholder="Password" required>
    <div class="checkbox mb-3">
        <label>
            <input type="checkbox" id="rememberMe" name="rememberMe"> Remember me
        </label>
    </div>
    <button class="btn btn-lg btn-primary btn-block" type="button" onclick="submit()">Sign in</button>
    <p class="mt-5 mb-3 text-muted">&copy; 2017-2020</p>
</div>
</body>
</html>

<script src="./js/jquery-3.5.1.min.js" type="text/javascript"></script>

<script type="text/javascript">
    function submit() {
        const inputEmail = $("#inputEmail").val();
        const inputPassword = $("#inputPassword").val();
        const rememberMe = $("#rememberMe").prop('checked');

        $.ajax({
            url: "/login",
            method: "post",
            data: {
                inputPassword: inputPassword,
                inputEmail: inputEmail,
                rememberMe: rememberMe
            },
            success: function (data) {
                console.log(data)
                window.location.href = "/";
            }
        });

    }
</script>
